#include <iostream>
using namespace std;

const int kMaxN = 2e5 + 10;

int a[kMaxN], cnt[kMaxN], num[kMaxN];
bool used[kMaxN];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  int ans = 0, tot = 0;

  for (int i = 1; i <= n; i++) {
    if (cnt[i] == 0) {
      num[tot++] = i;
    }
  }
  for (int i = 0, now = 0; i < n; i++) {
    if ((cnt[a[i]] > 1 && num[now] < a[i]) || used[a[i]]) {
      cnt[a[i]]--;
      ans++;
      a[i] = num[now++];
      used[a[i]] = true;
    } else {
      cnt[a[i]]--;
      used[a[i]] = true;
    }
  }
  cout << ans << "\n";
  for (int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  return 0;
}